We are given a square-shaped field. The field has a side of length
and it is divided into
squares of side
. Each square
is either arable or waste land. We delimit a parcel in the field. The parcel
ought to be a rectangle and to consist of only arable squares. The area of the
parcel is equal to the area of the corresponding rectangle. We seek for a parcel
of the largest area.
Write a program which:
In the first line of the standard input there is one integer
,
. In the successive
lines there are
descriptions of squares that compose successive rows of the field. Each of those
lines comprises
numbers 0 or 1, separated by
single spaces. The numbers describe successive squares in the row: 0
denotes an arable square and 1 denotes a waste square.
Your program should write one integer in the first and only line of the standard output. The number should be the area of the largest parcel. If all the squares are waste and there is no parcel, your program should give the answer 0.
For the input data:
5 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0
the correct result is:
9
Task author: Jakub Pawlewicz.
In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.